﻿using System;
using System.Collections.Generic;
using System.Text;

namespace DreamBox.Net.Data
{
    public class DbRow
    {
        private List<DbColumn> _column = new List<DbColumn>();
        public DbRow()
        {
        }
        public List<DbColumn> Columns { get { return _column; } }

        public void Add(DbColumn _dbColumn)
        {
            _column.Add(_dbColumn);
        }
        public int Count { get { return _column.Count; } }
        public void Remove()
        {
            _column.Clear();
        }
        public void Remove(int index)
        {
            _column.RemoveAt(index);
        }
        public object this[int index]
        {
            get {
                return _column[index].Value;
            }
        }
        public object this[string columnname]
        {
            get {
                object result = null;
                foreach (DbColumn dc in _column)
                {
                    if (dc.Name == columnname)
                    {
                        result = dc.Value;
                        break;
                    }
                }
                return result;
            }
        }
    }
}
